﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace WebApplication1.Controllers
{
    public class ZTreeController : Controller
    {
        public IActionResult Index()
        {
            return View();



        }
        [HttpGet]
        public IActionResult GetZtree(string zree)
        {

			var dic = new Dictionary<string, object>();
			var list = new List<Dictionary<string, object>>();
            dic = new Dictionary<string, object>
            {
               { "name","根节点" },
               { "id",1 },
               { "pid",0},
            };
            list.Add(dic);
			dic = new Dictionary<string, object>
			{
			   { "name","子节点11" },
			   { "id",11 },
			   { "pid",1},
			 };
			list.Add(dic);
			dic = new Dictionary<string, object>
			 {

				 { "name","子节点12" },
				 { "id",12 },
				 { "pid",1},
			   };
			list.Add(dic);
			dic = new Dictionary<string, object>
			  {

				 { "name","子节点13" },
				 { "id",13 },
				 { "pid",1},
			   };
			list.Add(dic);
			dic = new Dictionary<string, object>
			  {

				 { "name","根节点1" },
				 { "id",2 },
				 { "pid",0},
			   };
			list.Add(dic);
			dic = new Dictionary<string, object>
			  {

				 { "name","子节点2" },
				 { "id",21 },
				 { "pid",2},
			   };
			list.Add(dic);
			dic = new Dictionary<string, object>
			 {

				 { "name","根节点2" },
				 { "id",3 },
				 { "pid",0},
			  };
			list.Add(dic);
            dic = new Dictionary<string, object>
             {

                 { "name","子节点3" },
                 { "id",123 },
                 { "pid",3},
              };
            list.Add(dic);
            return Json(new { status = "1", value = list });

        }


    }
}